<?php

/**
 * This is the model class for table "luastanamproduksiubikayu".
 *
 * The followings are the available columns in table 'luastanamproduksiubikayu':
 * @property integer $ltpuk_id
 * @property integer $ltpuk_kec
 * @property integer $ltpuk_tanam
 * @property integer $ltpuk_panen
 * @property integer $ltpuk_produksi
 * @property double $ltpuk_rata
 * @property integer $ltpuk_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $ltpukKec
 */
class Luastanamproduksiubikayu extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Luastanamproduksiubikayu the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'luastanamproduksiubikayu';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('ltpuk_kec, ltpuk_tanam, ltpuk_panen, ltpuk_produksi, ltpuk_tahun', 'numerical', 'integerOnly'=>true),
			array('ltpuk_rata', 'numerical'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('ltpuk_id, ltpuk_kec, ltpuk_tanam, ltpuk_panen, ltpuk_produksi, ltpuk_rata, ltpuk_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'ltpukKec' => array(self::BELONGS_TO, 'Kecamatan', 'ltpuk_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'ltpuk_id' => 'Ltpuk',
			'ltpuk_kec' => 'Kecamatan',
			'ltpuk_tanam' => 'Luas Tanam(Ha)',
			'ltpuk_panen' => 'Luas Panen(Ha)',
			'ltpuk_produksi' => 'Produksi(Ton)',
			'ltpuk_rata' => 'Rata-Rata',
			'ltpuk_tahun' => 'Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('ltpuk_id',$this->ltpuk_id);
		$criteria->compare('ltpuk_kec',$this->ltpuk_kec);
		$criteria->compare('ltpuk_tanam',$this->ltpuk_tanam);
		$criteria->compare('ltpuk_panen',$this->ltpuk_panen);
		$criteria->compare('ltpuk_produksi',$this->ltpuk_produksi);
		$criteria->compare('ltpuk_rata',$this->ltpuk_rata);
		$criteria->compare('ltpuk_tahun',$this->ltpuk_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}